package de.fhaugsburg.games.boardgames;

import de.fhaugsburg.games.boardgames.scrabble.scrabbleboard.IPiece;


public class Square <P extends IPiece, D>{
	
	private P piece;
	private D details;

	/**
	 * Constructor
	 */
	public Square(){
	}
	
	
	/**
	 * puts a piece on this position
	 * @param piece
	 */
	public void putPiece(P piece) {
		this.piece = piece;
	}

	/**
	 * returns the piece from this postion
	 * @return
	 */
	public P getPiece() {
		return this.piece;
	}

	/**
	 * removes the piece
	 * @return
	 */
	public P removePiece() {
		P returnPiece = this.piece;
		this.piece = null;
		return returnPiece;
	}

	
	
	
	/**
	 * sets the details of this square, differing between the different games
	 * @param details
	 */
	public void setDetails(D details) {
		this.details = details;
	}

	/**
	 * get details of this square
	 * @return
	 */
	public D getDetails() {
		return details;
	}

	/**
	 * removes details from this square
	 * @return
	 */
	public D removeDetails(){
		D returnDetails = this.details;
		this.details = null;
		return returnDetails;
	}
	
	
}